package reese.think_in_java.java_21_thread;

/**
 * ***********************************************************
 *
 * @类名 : reese.think_in_java.java_21_thread.类名
 * @DESCRIPTION : 这家伙太懒啥都没写
 * @AUTHOR :  一个风情万种的男子
 * @DATE : 2016/6/7
 * ***********************************************************
 */

class Blocker {
    synchronized void waitingCall() {
        try {
            while(!Thread.interrupted()) {
                wait();
                System.out.print(Thread.currentThread() + " ");
            }
        } catch(InterruptedException e) {
            // OK to exit this way
        }
    }
    synchronized void prod() { notify(); }

    synchronized void prodAll() { notifyAll(); }
}

class Task implements Runnable {

    static Blocker blocker = new Blocker();
    @Override

    public void run() {
        blocker.waitingCall();

    }
}

class Task2 implements Runnable {
    // A separate Blocker object:
    static Blocker blocker = new Blocker();
    public void run() { blocker.waitingCall(); }
}


public class NotifyVsNotifyAll {
    public static void main(String[] args) {

    }
}
